package com.example.radiationarea.world.biome;

import com.example.radiationarea.block.ModBlocks;
import com.example.radiationarea.RadiationAreaMod;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.SurfaceRules;
import net.minecraft.world.level.levelgen.VerticalAnchor;

/**
 * A class responsible for defining the surface generation rules for the radiation area.
 */
public class RadiationSurfaceRules {

    /**
     * Creates the surface rules specifically for the radiation biome.
     * This rule places contaminated dirt on the topmost floor blocks.
     *
     * @return The rule source for generating the radiation surface.
     */
    public static SurfaceRules.RuleSource makeRadiationSurfaceRules() {
        return SurfaceRules.sequence(
            // Surface rule - use contaminated dirt instead of grass/dirt
            SurfaceRules.ifTrue(
                SurfaceRules.ON_FLOOR,
                SurfaceRules.sequence(
                    SurfaceRules.ifTrue(
                        SurfaceRules.waterBlockCheck(-1, 0),
                        SurfaceRules.state(ModBlocks.CONTAMINATED_DIRT.get().defaultBlockState())
                    ),
                    SurfaceRules.state(ModBlocks.CONTAMINATED_DIRT.get().defaultBlockState())
                )
            ),
            
            // Default to contaminated dirt for everything else
            SurfaceRules.state(ModBlocks.CONTAMINATED_DIRT.get().defaultBlockState())
        );
    }
}